.\"     $NetBSD: util.3,v 1.24 2011/08/29 12:39:50 jruoho Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Gregory McGarry.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 29, 2011
.Dt UTIL 3
.Os
.Sh NAME
.Nm util ,
.Nm libutil
.Nd system utilities library
.Sh LIBRARY
.Lb libutil
.Sh DESCRIPTION
The
.Nm
library is the system utilities library and contains various
system-dependent utility routines used in a wide variety of system daemons.
The abstracted functions are mostly related to pseudo-terminals
and login accounting.
These routines are
.Nx Ns -specific
and are not portable.
Their use should be restricted.
.Pp
Declarations for these functions may be obtained from the include file
.In util.h .
The
.Nm
library and the associated functions are implemented within the
.Pa /usr/src/lib/libutil
directory.
.Sh LIST OF FUNCTIONS
.Bl -column ".Xr sockaddr_snprintf 3" -compact
.It Sy Name	Description
.It Xr disklabel_dkcksum 3 Ta compute the checksum for a disklabel
.It Xr disklabel_scan 3 Ta scan a buffer for a valid disklabel
.It Xr forkpty 3 Ta tty utility function
.It Xr getbootfile 3 Ta get the name of the booted kernel file
.It Xr getlabeloffset 3 Ta get the sector number and offset of the disklabel
.It Xr getlabelsector 3 Ta get the sector number and offset of the disklabel
.It Xr getmaxpartitions 3 Ta get the maximum number of partitions allowed per disk
.It Xr getrawpartition 3 Ta get the system ``raw'' partition
.It Xr login 3 Ta login utility function
.It Xr login_cap 3 Ta query login.conf database about a user class
.It Xr login_close 3 Ta query login.conf database about a user class
.It Xr login_getcapbool 3 Ta query login.conf database about a user class
.It Xr login_getcapnum 3 Ta query login.conf database about a user class
.It Xr login_getcapsize 3 Ta query login.conf database about a user class
.It Xr login_getcapstr 3 Ta query login.conf database about a user class
.It Xr login_getcaptime 3 Ta query login.conf database about a user class
.It Xr login_getclass 3 Ta query login.conf database about a user class
.It Xr login_tty 3 Ta tty utility function
.It Xr loginx 3 Ta login utility function
.It Xr logout 3 Ta login utility function
.It Xr logoutx 3 Ta login utility function
.It Xr logwtmp 3 Ta login utility function
.It Xr logwtmpx 3 Ta login utility function
.It Xr opendisk 3 Ta open a disk partition
.It Xr openpty 3 Ta tty utility function
.It Xr pidfile 3 Ta write a daemon pid file
.It Xr pidlock 3 Ta locks based on files containing PIDs
.It Xr pw_abort 3 Ta passwd file update function
.It Xr pw_copy 3 Ta utility function for interactive passwd file updates
.It Xr pw_edit 3 Ta utility function for interactive passwd file updates
.It Xr pw_error 3 Ta utility function for interactive passwd file updates
.It Xr pw_getconf 3 Ta password encryption configuration access function
.It Xr pw_getprefix 3 Ta passwd file update function
.It Xr pw_init 3 Ta utility function for interactive passwd file updates
.It Xr pw_lock 3 Ta passwd file update function
.It Xr pw_mkdb 3 Ta passwd file update function
.It Xr pw_prompt 3 Ta utility function for interactive passwd file updates
.It Xr pw_scan 3 Ta utility function for interactive passwd file updates
.It Xr pw_setprefix 3 Ta passwd file update function
.It Xr secure_path 3 Ta determine if a file appears to be ``secure''
.It Xr setclasscontext 3 Ta query login.conf database about a user class
.It Xr setusercontext 3 Ta query login.conf database about a user class
.It Xr snprintb 3 Ta bitmask output conversion
.It Xr sockaddr_snprintf 3 Ta socket address formatting function
.It Xr strpct 3 Ta decimal percent formatter
.It Xr ttyaction 3 Ta ttyaction utility function
.It Xr ttylock 3 Ta locks based on files containing PIDs
.It Xr ttymsg 3 Ta ttymsg utility function
.It Xr ttyunlock 3 Ta locks based on files containing PIDs
.El
.Sh FILES
.Bl -tag -width /usr/lib/libutil_p.a -compact
.It Pa /usr/lib/libutil.a
static util library
.It Pa /usr/lib/libutil.so
dynamic util library
.It Pa /usr/lib/libutil_p.a
static util library compiled for profiling
.El
.Sh SEE ALSO
.Xr efun 3 ,
.Xr intro 3
